var doc = document; 
var cont = 0;
function creaDiv(name)
{
    var newDiv = doc.createElement("div"); 
    newDiv.setAttribute("id","id"+"_"+name+cont);  
    newDiv.innerHTML = "<h2>"+name+cont+"</h2>";
    var x = doc.createElement("img");  
    x.setAttribute("src","Images/close.png");  
    x.setAttribute("onclick","quitaDiv("+"id"+"_"+name+cont+")");
    x.setAttribute("class","equis"); 
    x.setAttribute("id","id"+"_"+name+cont++); 
    newDiv.appendChild(x); 
    doc.getElementById("main").appendChild(newDiv);
} 

function quitaDiv(event)
{
    doc.getElementById("main").removeChild(event);
}
